package com.dingwen.spsest.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dingwen.spsest.entity.RoleEntity;
import com.dingwen.spsest.mapper.RoleMapper;
import com.dingwen.spsest.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * role service impl
 *
 * @author dingwen
 * 2021.05.18 15:43
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, RoleEntity> implements RoleService {

    private final RoleMapper roleMapper;

    @Autowired
    public RoleServiceImpl(RoleMapper roleMapper) {
        this.roleMapper = roleMapper;
    }

    /**
     * 根据用户ID查询角色
     *
     * @param userId 用户id
     * @return {@link List<RoleEntity>}
     */
    @Override
    public List<RoleEntity> selectRoleByUserId(Integer userId) {
        return roleMapper.selectRoleByUserId(userId);
    }
}
